import java.util.*;

public class size {

    public static void main(String args[]){

        Scanner reader=new Scanner(System.in);

    int a[]=new int[100];

    int b[]=new int[100];

    int t[]=new int[100];

    int i=0,j=0;

    int n=0;

    int s=0,c=0;

    float d=0;

        System.out.printf("请问需要生成多少个题目:");

    n=reader.nextInt();

for(j=0;j<n;j++){

    Random rand=new Random();

        for(i=0;i<100;i++)

        {a[i]=rand.nextInt(6)+1;

            b[i]=rand.nextInt(4)+1;

            t[i]=rand.nextInt(10)+1;

        }

        if(b[0]==1)

        {System.out.printf("%d + %d",t[0],t[1]);

            s=t[0]+t[1];}

        if(b[0]==2)

        {System.out.printf("%d  - %d",t[0],t[1]);

            s=t[0]-t[1];}

        if(b[0]==3)

        {System.out.printf("%d * %d",t[0],t[1]);

            s=t[0]*t[1];}

        if(b[0]==4)

        {System.out.printf("%d / %d",t[0],t[1]);

            s=t[0]/t[1];}

        for(i=3;i<=a[i];i++){

            if(b[i-2]==1)

            {System.out.printf(" + %d",t[i-1]);

                s=s+t[i-1];}

            if(b[i-2]==2)

            {System.out.printf(" - %d",t[i-1]);

                s=s-t[i-1];}

            if(b[i-2]==3)

            {System.out.printf(" * %d",t[i-1]);

                s=s*t[i-1];}

            if(b[i-2]==4)

            {System.out.printf(" / %d",t[i-1]);

                s=s/t[i-1];}

        }

        System.out.printf(" =");

        c=reader.nextInt();

        if(s==c)

        {d=d+1;

            System.out.printf("正确");}

        if(s!=c)

            System.out.printf("错误，正确答案为：%d",s);

        System.out.printf("\n");

    }

        System.out.printf("正确率为%f",d/n);}

}
